/*
 * author      : dormi330 
 * date        : 2018/7/20
 * description : 输入导致的错误, 非系统错误
 * 对应 http code 400~499
 */

package com.deep.trade.application.exception;

import com.deep.trade.common.TradeException;
import org.springframework.http.HttpStatus;

public class LayerApplicationException extends TradeException {

    public LayerApplicationException(int code, String msg) {
        super(code, msg);
    }


    /** 未授权 */
    public static LayerApplicationException unauthorized(String reason) {
        return new LayerApplicationException(HttpStatus.UNAUTHORIZED.value(), "未授权:" + reason);
    }

    /** 数据校验不通过, 无效数据 */
    public static LayerApplicationException dataInvalid(String reason) {
        return new LayerApplicationException(HttpStatus.BAD_REQUEST.value(), "无效的数据:" + reason);
    }

}
